<!--
 @description  帮助中心内容项(搜索结果内容项)
 @fileName ListItem.vue
 @author zengqiongying
 @created 2022/02/26 15:08:53
-->
<template>
  <div class="list-item">
    <div v-if="g.coverUrl" class="item-img">
      <ImageVideo lazy-load :host="imgHost" :src="g.coverUrl" fit="fill" />
      <svg-icon v-if="g.contentType===2" icon-class="bofang-solid" class="icon-video" />
    </div>
    <div class="item-content">
      <div class="i-name">{{ g.title }}</div>
      <div class="i_bottom">
        <span class="i-icon">{{ g.readNum || 0 }}</span>
        <span>{{ g.lastUpdateTime | filterTime }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import ImageVideo from '@/components/ImageVideo'
import { parseTime } from '@/utils'
export default {
  name: 'HelpContentListItem',
  components: {
    ImageVideo
  },
  filters: {
    filterTime(val) {
      return parseTime(val, '{y}.{m}.{d} {h}:{i}:{s}')
    }
  },
  props: {
    g: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      imgHost: `${process.env.VUE_APP_ADS_STATIC}`
    }
  },
  computed: {},

  created() {},
  activated() {},

  mounted() {},

  methods: {}
}

</script>
<style lang='less' scoped>
.list-item{
  padding: 15px 10px;
  background: #fff;
  border-bottom: #EFEFEF 1px solid;
  display: flex;
  &:last-child{
    border-bottom:0;
  }
  .item-img{
    width: 120px;
    height: 90px;
    margin-right: 15px;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5ff;
    position: relative;
    .icon-video{
      position:absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%,-50%);
      font-size: 40px;
      color: rgba(255, 255, 255, .8);
    }
  }
  .item-content{
    flex: 1;
    // max-height:90px;
    display:flex;
    flex-direction: column;
    justify-content: space-between;
    .i-name{
      width: 100%;
      max-height: 52px;
      line-height: 26px;
      font-size: 14px;
      color: #333333;
      letter-spacing: 1px;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
    }
    .i_bottom{
      margin-top: 10px;
      width: 100%;
      height: 16px;
      line-height: 16px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      color:#AAAAAA;
      font-size:12px;
    }
    .i-icon{
      display: flex;
      align-items: center;
      &::before{
        content: '';
        width: 16px;
        height: 16px;
        margin-right: 5px;
        background: url(~@/assets/icon-view.png) no-repeat;
        background-size: 16px 16px;

      }
    }
  }
}
</style>
